import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {MinerService} from "../miner.service";
import {SettingUrl} from "../../../public/setting/setting_url";

@Component({
  selector: 'app-miner-item-detail',
  templateUrl: './miner-item-detail.component.html',
  styleUrls: ['./miner-item-detail.component.css']
})
export class MinerItemDetailComponent implements OnInit {
  private code: string;
  public minerItemInfo: any = {};//minerItem信息

  constructor(private minerService: MinerService, private route: ActivatedRoute, private router: Router) {
  }

  ngOnInit() {
    this.code = this.route.snapshot.params.code;//获取参数
    this.loadMinerItemInfo();//查询minerItem类型列表
  }

  /**
   * 查询minerItem信息
   */
  loadMinerItemInfo() {
    this.minerService.loadMinerItemByCode(this.code).then((data: any) => {
      if (data) this.minerItemInfo = data;
    })
  }

  /**
   * 修改未设置数据
   */
  toModifyTheUnSetData() {
    this.router.navigate([SettingUrl.ROUTERLINK.minerItem.modify, this.code])
  }

}
